﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AgnisEbmtTranslator.Custom_Controls
{
    public partial class ExBindingSource : BindingSource , IEquatable<ExBindingSource>
    {
        public ExBindingSource()
        {
            InitializeComponent();
        }
        private string bsName;
        private bool rFilter;
        public string Name {get { return bsName; } set { bsName = value; } }
        public ExBindingSource(string _bsName)
        {
            bsName  = _bsName;
        }

        public bool isRecordFiltered { get { return rFilter; } set { rFilter = value; } }

        #region IEquatable<ExBindingSource> Membres

        public bool Equals(ExBindingSource other)
        {
            if (other.Name == this.Name)
            { return true; }
            else
            { return false; }
        }

        public override bool Equals(Object obj)
        {
            if (obj == null) return base.Equals(obj);

            if (!(obj is ExBindingSource))
                throw new InvalidCastException("The 'obj' argument is not a ExBindingSource object.");
            else
                return Equals(obj as ExBindingSource);
        }

        public override int GetHashCode()
        {
            return this.Name.GetHashCode();
        }
        #endregion
    }
}
